1. Field of the Invention
The present invention relates to a memory controller, and more specifically, to a memory controller having an error correction function.
2. Description of the Related Art
NAND type flash memory has been demanded more and more as it is used in the memory card. As the usage increasing, a memory card that operates at a faster speed with a more mass storage has been demanded. In order to respond to that demand, a NAND type flash memory using more fine processes has been developed. As it becomes finer, however, the capacity of the deleting unit of the NAND type flash memory called “block” (block size) has also increased.
In the NAND type flash memory that cannot overwrite data at the same physical address, data copy of the entire block including the memory region is required for rewriting a part of memory region. Therefore, increase of the block size increases a time required for data copy and slows down the writing speed of the memory as a result.
In order to cope with the problems, the modern NAND type flash memory has a page copy function (see, for example, Japanese Patent Laid Open No. 2005-78378). The page copy function is a function of specifying the copied-page address and page-to-be-copied address and performing data copy between blocks by page via a buffer (page buffer) included by the NAND type flash memory. Here, the term “page” is a unit of data smaller than a block. The data per page is called a page data. By using the page copy function, data copy between blocks is performed in the NAND type flash memory. Therefore, it is not needed to read out a data from the copied block to a host appliance or a memory controller and write the read data into a block-to-be-copied. That is to say, by using a page copy function, data copy between blocks in the NAND type flash memory can be speeded up.
Generally, if the NAND type flash memory is used, error correction is performed in consideration of data error due to deterioration of the memory cell or the like. For example, the memory controller examines whether data read from the NAND type flash memory has an error or not by an error examining function using the Read-Solomon code or the like. When the host appliance reads out a data and if the data has a correctable error, error correction is performed on the data and the corrected data is outputted from the memory controller to the host appliance. If data copy is performed between blocks, the data is read from the NAND type flash memory to the memory controller, and if the read data has a correctable error, error correction is performed and the corrected data is transferred from the memory controller to the NAND type flash memory. If error correction is not performed on the data, data that has been stored in the page buffer is written into the NAND type flash memory. That is to say, if data read from the NAND type flash memory has no error, data copy is performed between blocks via a page buffer without the page copy function transferring data from the memory controller to the NAND type flash memory. As a result, a data transferring time can be eliminated.
If the data read from the NAND type flash memory has no error, the management data stored in the redundant part other than the data part that stores the real data included in each page needs to be changed.
The NAND type flash memory has a function of rewriting only the changed part of the page buffer if a part of page data stored in the data part or the redundant part is changed. Accordingly, if only the changed data, for example, a management data is rewritten, a time required for rewriting data of the NAND type flash memory can be reduced. In the memory system configured to store the error correction code of the data in the redundant part, however, even if a part of page data is changed, page data needs to be read to the memory controller and changed, and the memory controller needs to calculate error correction codes from the head byte in order for the changed page data. Generally, a time for calculating the error correction code of the data is almost the same as a time for the memory controller to write data into the NAND type flash memory. That is to say, calculation of error correction code of the partially changed data needs about the same time as for rewriting all the data stored in the data part or the redundant part.